package caiziyou.com.designpattern.mediator.smarthouse;

import java.util.HashMap;

public class ConcreteMediator extends Mediator {

	private HashMap<String, Colleague> colleagueMap;
	private HashMap<String, String> interMap;

	public ConcreteMediator() {
		super();
		colleagueMap = new HashMap<>();
		interMap = new HashMap<>();
	}

	@Override
	public void register(String ColleagueName, Colleague colleague) {
		
		colleagueMap.put(ColleagueName, colleague);
		if(colleague instanceof Alarm) {
			interMap.put("Alarm", ColleagueName);
		} else if(colleague instanceof CoffeeMachine) {
			interMap.put("CoffeeMachine", ColleagueName);
		} else if(colleague instanceof TV) {
			interMap.put("TV", ColleagueName);
		} else if(colleague instanceof Curtains) {
			interMap.put("Curtains", ColleagueName);
		} 
	}

	@Override
	public void sendMeaaage(int stateChange, Colleague colleague) {
		
		
	}

	@Override
	public void getMeaaage(int stateChange, String ColleagueName) {

		Colleague colleague = colleagueMap.get(ColleagueName);
		if(colleague instanceof Alarm) {
			if(stateChange == 0) {
				
			}
		}
	}

}
